import { useState, useRef } from 'react'
import {
  backendOrderList,
  ecommerceOrderList,
  showPrivacy,
  orderNumberCount,
  ecommerceOrderCount,
  getShareLinkMap,
  addRemark,
  getRemarkList,
  depositThaw,
  refundDeposit,
  depositTransferPay,
  deleteOrders,
  closeOrders,
  adminLookExpress,
  getOverdueMoney,
  dealAfterSale,
  getAfterSaleRejectReason,
  expressCompany,
  addExpress,
  getShopSalesMan,
  allocateOrders,
  updateExpress,
  refundSfAmount,
  deliveryVerify,
  getSubShopOptions,
  getOrderAuditors,
  allocateToSubShop,
  getAllAuditors,
  wxGenerateScheme,
  orderVoucherList,
  lookExpress,
  unsignContractPay,
  alterOrderPrice,
  getListForAmendOrder,
  submitAmendOrder,
  getPlatformCreditType,
  getExpiredBillsData,
  getExpiredBillsDataCount,
} from '@/services/Order'

export default () => {
  // const [Spu, SetSpu] = useState([]);
  // const [Rent, SetRent] = useState([]);
  // const [Disabled, SetDisable] = useState(false);
  // const FormRef = useRef();

  // 获取订单列表
  const GetBackendOrderList = (params: any) => {
    return backendOrderList(params)
  }

  // 电商订单列表
  const EcommerceOrderList = (params: any) => {
    return ecommerceOrderList(params)
  }

  // 获取脱敏信息
  const ShowPrivacy = (data: any) => {
    return showPrivacy(data)
  }

  // 各状态订单数量
  const OrderNumberCount = (params: any) => {
    return orderNumberCount(params)
  }

  // 电商状态订单数量
  const EcommerceOrderCount = (params: any) => {
    return ecommerceOrderCount(params)
  }

  // 渠道列表
  const GetShareLinkMap = () => {
    return getShareLinkMap()
  }

  // 查看备注记录
  const GetRemarkList = <T>(params: T) => {
    return getRemarkList(params)
  }

  // 添加备注
  const AddRemark = <T>(data: T) => {
    return addRemark(data)
  }

  // 押金解冻
  const DepositThaw = (data: { order_sn: string }) => {
    return depositThaw(data)
  }

  // 退还押金
  const RefundDeposit = (data: { order_id: string }) => {
    return refundDeposit(data)
  }

  // 押金转支付
  const DepositTransferPay = (data: { order_id: string }) => {
    return depositTransferPay(data)
  }

  // 删除订单
  const DeleteOrders = (data: { order_id: string }) => {
    return deleteOrders(data)
  }

  // 关闭订单
  const CloseOrders = (data: { order_id: string }) => {
    return closeOrders(data)
  }

  // 查看物流
  const AdminLookExpress = (params: { id: string | number; type: string | number }) => {
    return adminLookExpress(params)
  }

  // 获取逾期金额
  const GetOverdueMoney = (params: any) => {
    return getOverdueMoney(params)
  }

  // 处理售后
  const DealAfterSale = (data: { order_id: string; type: string; reject_reason?: string }) => {
    return dealAfterSale(data)
  }

  // 获取订单用户申请售后的原因
  const GetAfterSaleRejectReason = (data: any) => {
    return getAfterSaleRejectReason(data)
  }

  // 获取物流公司
  const GetExpressCompany = (params: any) => {
    return expressCompany(params)
  }

  // 发货
  const AddExpress = (data: any) => {
    return addExpress(data)
  }

  // 获取业务员公司
  const GetShopSalesMan = (params: any) => {
    return getShopSalesMan(params)
  }

  // 订单分配
  const AllocateOrders = (data: any) => {
    return allocateOrders(data)
  }

  // 修改物流
  const UpdateExpress = (data: any) => {
    return updateExpress(data)
  }

  // 电商退款
  const RefundSfAmount = (data: any) => {
    return refundSfAmount(data)
  }

  // 自提验证
  const DeliveryVerify = (data: any) => {
    return deliveryVerify(data)
  }

  // 子店铺选项列表接口
  const GetSubShopOptions = (data: any) => {
    return getSubShopOptions(data)
  }

  // 动态获取审核员列表
  const GetOrderAuditors = (data: any) => {
    return getOrderAuditors(data)
  }

  // 订单分配给子店铺
  const AllocateToSubShop = (data: any) => {
    return allocateToSubShop(data)
  }

  // 获取所有审核员列表
  const GetAllAuditors = (data: any) => {
    return getAllAuditors(data)
  }

  // 生成微信url
  const WxGenerateScheme = (data: any) => {
    return wxGenerateScheme(data)
  }

  // 优惠券信息列表
  const OrderVoucherList = (data: any) => {
    return orderVoucherList(data)
  }

  //  express
  const LookExpress = (data: any) => {
    return lookExpress(data)
  }

  //  express
  const UnsignContractPay = (data: any) => {
    return unsignContractPay(data)
  }

  //  增值服务列表
  const GetListForAmendOrder = (data: any) => {
    return getListForAmendOrder(data)
  }

  //  生成补订单付款码
  const SubmitAmendOrder = (data: any) => {
    return submitAmendOrder(data)
  }

  // 改价格
  const AlterOrderPrice = (data: any) => {
    return alterOrderPrice(data)
  }

  // 新、老征信开关
  const GetPlatformCreditType = () => {
    return getPlatformCreditType()
  }

  // 到期账单
  const GetExpiredBillsData = (data: any) => {
    return getExpiredBillsData(data)
  }

  // 到期账单
  const GetExpiredBillsDataCount = (data: any) => {
    return getExpiredBillsDataCount(data)
  }

  return {
    GetBackendOrderList,
    ShowPrivacy,
    OrderNumberCount,
    GetShareLinkMap,
    GetRemarkList,
    AddRemark,
    DepositThaw,
    RefundDeposit,
    DepositTransferPay,
    DeleteOrders,
    CloseOrders,
    AdminLookExpress,
    GetOverdueMoney,
    DealAfterSale,
    GetAfterSaleRejectReason,
    GetExpressCompany,
    AddExpress,
    GetShopSalesMan,
    AllocateOrders,
    UpdateExpress,
    EcommerceOrderList,
    EcommerceOrderCount,
    RefundSfAmount,
    DeliveryVerify,
    GetSubShopOptions,
    GetOrderAuditors,
    AllocateToSubShop,
    GetAllAuditors,
    WxGenerateScheme,
    OrderVoucherList,
    LookExpress,
    UnsignContractPay,
    AlterOrderPrice,
    GetListForAmendOrder,
    SubmitAmendOrder,
    GetPlatformCreditType,
    GetExpiredBillsData,
    GetExpiredBillsDataCount,
  }
}
